/**全选择所有的消息**/
function selectAll(){	
	var obj = document.getElementsByName('checkbox');
	var iLen = obj.length;
	var i;
	
	for(i=0; i<iLen; ++i){
		obj[i].checked = true;
	}
}

/**取消所有被选中的item**/
function unSelectAll(){
	var obj = document.getElementsByName('checkbox');
	var iLen = obj.length;
	var i;
	
	for(i=0; i<iLen; ++i){
		obj[i].checked = false;
	}
}


/**彻底删除当前选择的信息**/
function deleteSelect(page){
	var obj = document.getElementsByName('checkbox');
	var objLen = obj.length;
	var i;
	var j = 0;
	var str = "";

	for(i=0; i<objLen; ++i){
		if(obj[i].checked==true){		
			str = str + obj[i].value + ";";
			++j;
		}
	}	
	
	if(j==0){
		alert("请选择要删除的记录.");
		return;
	}
    if( confirm( "您确实要删除吗？" ) ){
    	AjaxAction.syncCall('userFriendAction.delWJoin',str);
    	if(page == 1){
   		    window.location.href = "py.jsp";			
	   	}else if(page == 2){
    	    window.location.href = "pywfjoin.jsp";			
    	}else if(page == 3){
    	    window.location.href = "pybl.jsp";			
    	}

	}else{
		return;
	}
}
/* 在好友列表中删除 */
function deleteSelectG(){
	var obj = document.getElementsByName('checkbox');
	var objLen = obj.length;
	var i;
	var j = 0;
	var str = "";

	for(i=0; i<objLen; ++i){
		if(obj[i].checked==true){		
			str = str + obj[i].value + ";";
			++j;
		}
	}	
	
	if(j==0){
		alert("请选择要删除的记录.");
		return;
	}
    if( confirm( "您确实要删除吗？" ) ){
    	var flag = AjaxAction.syncCall('userFriendAction.delGoodFr',str);    	
    	if(flag == 1){
   		   window.location.href = "py.jsp";			
   		}else{
   		   alert("删除失败");
   		   return;
   		} 

	}else{
		return;
	}
}

/**在待批好友中把所有被选中的item加为自己的好友**/
function addForFriend(){
	var obj = document.getElementsByName('checkbox');
	var objLen = obj.length;
	var i;
	var j = 0;
	var str = "";

	for(i=0; i<objLen; ++i){
		if(obj[i].checked==true){		
			str = str + obj[i].value + ";";
			++j;
		}
	}	
	
	if(j==0){
		alert("请选择要添加的记录.");
		return;
	}
    if( confirm( "您确实要把他们加为好友吗？" ) ){
    	AjaxAction.syncCall('userFriendAction.addJoinFriend',str);
	    window.location.href = "pywfjoin.jsp";			
	}else{
		return;
	}
}

/* 在黑名单中把所有选中的item进行好友申请操作 */
function addForFriendAly(){
	var obj = document.getElementsByName('checkbox');
	var objLen = obj.length;
	var i;
	var j = 0;
	var str = "";

	for(i=0; i<objLen; ++i){
		if(obj[i].checked==true){		
			str = str + obj[i].value + ";";
			++j;
		}
	}	
	
	if(j==0){
		alert("请选择要添加的记录.");
		return;
	}
    if( confirm( "您确实申请加ta们为好友吗？" ) ){
    	AjaxAction.syncCall('userFriendAction.addBAFriend',str);
	    window.location.href = "pybl.jsp";			
	}else{
		return;
	}
}

/* 删除所有被选中的收藏记录 */
function deleteCollect(){
	var obj = document.getElementsByName('checkbox');
	var objLen = obj.length;
	var i;
	var j = 0;
	var str = "";

	for(i=0; i<objLen; ++i){
		if(obj[i].checked==true){		
			str = str + obj[i].value + ";";
			++j;
		}
	}	
	
	if(j==0){
		alert("请选择要删除的记录.");
		return;
	}
    if( confirm( "您确实要删除吗？" ) ){
    	var flag = AjaxAction.syncCall('collectAction.deleteCollect',str);    	
    	if(flag == 1){
   		   window.location.href = "pycollect.jsp";			
   		}else{
   		   alert("删除失败");
   		   return;
   		} 

	}else{
		return;
	}
}
/* 删除用户的冲值信息 */
function deleteRush(){
	var obj = document.getElementsByName('checkbox');
	var objLen = obj.length;
	var i;
	var j = 0;
	var str = "";

	for(i=0; i<objLen; ++i){
		if(obj[i].checked==true){		
			str = str + obj[i].value + ";";
			++j;
		}
	}	
	
	if(j==0){
		alert("请选择要删除的记录.");
		return;
	}
    if( confirm( "您确实要删除吗？" ) ){
    	var flag = AjaxAction.syncCall('userInfoAction.deleteRush',str);    	
    	if(flag == 1){
   		   window.location.href = "accoutrush.jsp";			
   		}else{
   		   alert("删除失败");
   		   return;
   		} 

	}else{
		return;
	}
}
/* 删除用户的消费记录 */
function deleteConsume(){
	var obj = document.getElementsByName('checkbox');
	var objLen = obj.length;
	var i;
	var j = 0;
	var str = "";

	for(i=0; i<objLen; ++i){
		if(obj[i].checked==true){		
			str = str + obj[i].value + ";";
			++j;
		}
	}	
	
	if(j==0){
		alert("请选择要删除的记录.");
		return;
	}
    if( confirm( "您确实要删除吗？" ) ){
    	var flag = AjaxAction.syncCall('userInfoAction.deleteRush',str);    	
    	if(flag == 1){
   		   window.location.href = "accoutconsume.jsp";			
   		}else{
   		   alert("删除失败");
   		   return;
   		} 

	}else{
		return;
	}
}